www.gusucode.com > VC++网络版的打字软件源程序-源码程序 > VC++网络版的打字软件源程序-源码程序\code\TypeClt V2.0\Type.cpp

    //Download by http://www.NewXing.com
// Type.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "Type.h"

#include "MainFrm.h"
#include "TypeDoc.h"
#include "TypeView.h"
#include "MainView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#define FILE_TYPE_NAME		"Type.dat"		//成绩文件名称

#include "SkinPlusPlus.h"
/////////////////////////////////////////////////////////////////////////////
// CTypeApp

BEGIN_MESSAGE_MAP(CTypeApp, CWinApp)
	//{{AFX_MSG_MAP(CTypeApp)
	ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
	// Standard file based document commands
	ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
	ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
	// Standard print setup command
	ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTypeApp construction

CTypeApp::CTypeApp()
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CTypeApp object

CTypeApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CTypeApp initialization

BOOL CTypeApp::InitInstance()
{
	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}

	AfxEnableControlContainer();

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	// Change the registry key under which our settings are stored.
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization.
	SetRegistryKey(_T("Local AppWizard-Generated Applications"));

	LoadStdProfileSettings();  // Load standard INI file options (including MRU)

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views.
	InitializeSkin(_T(".\\skin\\XPCorona.ssk"));
	CSingleDocTemplate* pDocTemplate;
	pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CTypeDoc),
		RUNTIME_CLASS(CMainFrame),       // main SDI frame window
		RUNTIME_CLASS(CMainView));
	AddDocTemplate(pDocTemplate);

	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);
	
	// Dispatch commands specified on the command line
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;

	// 打开打字测试文件
	CFileStatus rStatus;
	if(CFile::GetStatus(FILE_TYPE_NAME,rStatus)==FALSE)
	{
		CFile(FILE_TYPE_NAME,CFile::modeCreate | CFile::modeWrite);
	}
	OpenDocumentFile(FILE_TYPE_NAME);
	
	// The one and only window has been initialized, so show and update it.
	CString strTitle;
	strTitle.LoadString(IDS_TITLE);
	m_pMainWnd->SetWindowText(strTitle);

	m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
	m_pMainWnd->UpdateWindow();


	return TRUE;
}


/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
	afx_msg void OnUpdateCntest01(CCmdUI* pCmdUI);
	afx_msg void OnUpdateCntest02(CCmdUI* pCmdUI);
	afx_msg void OnUpdateCntest03(CCmdUI* pCmdUI);
	afx_msg void OnUpdateCntest04(CCmdUI* pCmdUI);
	afx_msg void OnUpdateEntest01(CCmdUI* pCmdUI);
	afx_msg void OnUpdateEntest02(CCmdUI* pCmdUI);
	afx_msg void OnUpdateEntest03(CCmdUI* pCmdUI);
	afx_msg void OnUpdateEntest04(CCmdUI* pCmdUI);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
	ON_UPDATE_COMMAND_UI(ID_CNTEST01, OnUpdateCntest01)
	ON_UPDATE_COMMAND_UI(ID_CNTEST02, OnUpdateCntest02)
	ON_UPDATE_COMMAND_UI(ID_CNTEST03, OnUpdateCntest03)
	ON_UPDATE_COMMAND_UI(ID_CNTEST04, OnUpdateCntest04)
	ON_UPDATE_COMMAND_UI(ID_ENTEST01, OnUpdateEntest01)
	ON_UPDATE_COMMAND_UI(ID_ENTEST02, OnUpdateEntest02)
	ON_UPDATE_COMMAND_UI(ID_ENTEST03, OnUpdateEntest03)
	ON_UPDATE_COMMAND_UI(ID_ENTEST04, OnUpdateEntest04)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

// App command to run the dialog
void CTypeApp::OnAppAbout()
{
	CAboutDlg aboutDlg;
	aboutDlg.DoModal();
}

/////////////////////////////////////////////////////////////////////////////
// CTypeApp message handlers


int CTypeApp::ExitInstance() 
{
	// TODO: Add your specialized code here and/or call the base class
	ExitSkin();
	return CWinApp::ExitInstance();
}


void CAboutDlg::OnUpdateCntest01(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	
}

void CAboutDlg::OnUpdateCntest02(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	
}

void CAboutDlg::OnUpdateCntest03(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	
}

void CAboutDlg::OnUpdateCntest04(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	
}

void CAboutDlg::OnUpdateEntest01(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	
}

void CAboutDlg::OnUpdateEntest02(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	
}

void CAboutDlg::OnUpdateEntest03(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	
}

void CAboutDlg::OnUpdateEntest04(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	
}